<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/themes/bootstrap/easyui.css" />
<link type="text/css"
	href="${pageContext.request.contextPath}/themes/icon.css"
	rel="stylesheet">
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery-1.9.1.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
<title>Insert title here</title>
</head>
<script type="text/javascript">
$(function(){
	
	$('#dg').datagrid({    
	    url:'ShoScop_shoScop',
	    rownumbers:true,
	    pagination:true,
	    fitColumns:true,
	    pageSize:10,
	    pageList:[10,15,20],
	    columns:[[   
            {field:'checkbox',title:'ck',width:100,checkbox:true},
	        {field:'disid',title:'站点编号',width:100},    
	        {field:'disname',title:'站点名',width:100},    
	        {field:'distypeid',title:'站点属性',width:100,align:'right'},
	        {field:'cuser',title:'站点负责人姓名',width:100}, 
	        {field:'disscope',title:'配送范围',width:100}, 
	        {field:'disprice',title:'价格比例',width:100}, 
	        {field:'instation',title:'主线编号',width:100}, 
	        {field:'operate',title:'操作',align:'center',width:$(this).width()*0.1,  
	            formatter:function(value, row, index){  
	                var str = '<a href="#" name="opera" class="easyui-linkbutton" ></a>';  
	                return str;  
	        }},
	       
	        
	    ]] ,
	  //  onLoadSuccess:function(data){    
	     //   $("a[name='opera']").linkbutton({text:'编辑',plain:true,iconCls:'icon-add'}); 
	      //  $('a').click(function(){
	    		
	     //   	$('#win').window('open');
	        	
	    //	})
	  //  },   
	    toolbar: [{
			iconCls: 'icon-add',
			text:'编辑',
			handler: function(){
				var a=$('#dg').datagrid('getSelections'); 
				if(a.length==1){
					$('#win').window('open');
					$('#tb').textbox('setValue',a[0].disscope);
					$('#tb1').textbox('setValue',a[0].disprice);
					$('#tb2').textbox('setValue',a[0].disid);
				}else{
					$.messager.alert('我的消息','请选择一行进行编辑','info');


				}
			}
		
		}]

	});  
	//$('#win').window({    
	 //   width:600,    
	 //   height:400,    
	  //  modal:true,
	  //  closed:true,
	//});  

	   
	    $('#btn').bind('click', function(){ 
	    var disid=$('#tb2').textbox('getValue');
	    var disscope=$('#tb').textbox('getValue');
	    var disprice=$('#tb1').textbox('getValue');
	    $.ajax({
	    	url:'UpdateScope_updateScope',
	    	type:'post',
	    	data:{'disid':disid,'disscope':disscope,'disprice':disprice},
	    	dataType:'json',
	    	success:function(data){
	    		if(data==1){
	    			$.messager.show({
	    				title:'我的消息',
	    				msg:'保存成功',
	    				timeout:2000,
	    				showType:'slide'
	    			});
	    			$('#win').window('close');
	    			$('#dg').datagrid('reload');
	    		}
	    	}
	    })
	    });    


	    $('#btn1').bind('click', function(){    
	    	$('#win').window('close');  
	    });    

	
		
	
	
})
</script>
<body>

<table id="dg"></table>


<div id="win" class="easyui-window" title="信息管理" style="width:600px;height:400px"   
        data-options="closed:true,closable:true,modal:true">   

<div style="margin-top: 50px;margin-left: 100px">
<div style="display:none">
站点编号<input id="tb2" type="text" style="width:300px" class="easyui-textbox"><br></div>
配送范围<input id="tb" type="text" style="width:300px" class="easyui-textbox"><br><br><br>


价格比例<input id="tb1" type="text" style="width:300px" class="easyui-textbox"><br><br><br>
</div><br><br><div style="margin-top: 50px;margin-left: 220px">
<a id="btn" href="#" class="easyui-linkbutton">保存</a>
<a id="btn1" href="#" class="easyui-linkbutton">取消</a></div>
</div> 

</body>
</html>